package com.sykj.servies.impl;

import com.sykj.dao.CustomerDao;
import com.sykj.dao.ZiXunDao;
import com.sykj.pojo.Customer;
import com.sykj.pojo.ZiXun;
import com.sykj.servies.ZiXunService;
import com.sykj.servies.ZiXunServies;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ZiXunServiesImpl implements ZiXunService{
    @Autowired
    ZiXunDao ziXunDao;
    @Autowired
    CustomerDao customerDao;

    //审核，修改状态
    @Override
    public void shenhe(int zid) {
        ziXunDao.shenhe(zid);
    }
    //查询
    @Override
    public List<ZiXun> list1() {
        //查询资讯表
       List<ZiXun> zixuns=ziXunDao.selectByExample(null);
       for (ZiXun z:zixuns){
           //得到用户id
           Customer customer=customerDao.selectByPrimaryKey(z.getCstid());
           //赋值
           z.setCustomer(customer);
       }
        return zixuns;
    }

    @Override
    public List<ZiXun> list() {
        return null;
    }

    //前台增加资讯
    @Override
    public void save(ZiXun entity) {

    }

    //根据id删除
    @Override
    public void del(int id) {
        ziXunDao.deleteByPrimaryKey(id);
    }
    //得到资讯id
    @Override
    public ZiXun get(int id) {
        return null;
    }
}
